import { IS_TABLET_DEVICE, TABLET_WIDTH } from '../../constant';
import { phonePx } from '../../util/adapt';
import { getScreenInfo, ScreenOrientation } from '../../util/screen';

const { width, height } = getScreenInfo({
  screenOrientation: ScreenOrientation.Landscape
});

const height1 = IS_TABLET_DEVICE ? TABLET_WIDTH : height;

export enum ExplainType {
  Unknown,
  Common,
  CorrectAndWrong
}

export enum RoundType {
  Unknown = 0,
  Main = 1,
  Problem = 2,
  Video = 5,
  RollCall = 6
}

export enum VideoUploadStatus {
  Unknown,
  UnUpload,
  Upload
}

export enum UserRole {
  Unknown,
  Student,
  Teacher,
  Parent,
  Guest,
  Assist
}

export enum ProblemRoundStatus {
  Unknown = 0,
  DoProblemAfterDiscuss = 3,
  Analysis = 4
}

export enum LessonStatus {
  Unknown,
  UnStart,
  EarlyEntry,
  HaveStart,
  End
}

export enum ClassRoomType {
  Unknown,
  Live,
  Vod
}

let scale = 1;

let contentHeight = height1;
let contentWidth = (contentHeight * 640) / 360;
if (contentWidth > width) {
  contentWidth = width;
  contentHeight = (contentWidth * 360) / 640;
  scale = contentHeight / height1;
}

export const CLASS_ROOM_RIGHT_SCALE = scale;

export const CARD_WIDTH = (contentWidth / 640) * 480;
export const CARD_HEIGHT = contentHeight;

export const LIVE_AREA = phonePx(160) * CLASS_ROOM_RIGHT_SCALE;
export const LIVE_AREA_HEIGHT = phonePx(120) * CLASS_ROOM_RIGHT_SCALE;
export const LIVE_WIDTH = phonePx(73.5) * CLASS_ROOM_RIGHT_SCALE;
export const LIVE_HEIGHT = phonePx(56) * CLASS_ROOM_RIGHT_SCALE;

export const CONTENT_WIDTH = contentWidth;

export const MARGIN_TOP = (height - CARD_HEIGHT) / 2;
export const MARGIN_LEFT = (width - CONTENT_WIDTH) / 2;

export enum TextType {
  Unknown,
  Text,
  Url,
  Fill
}

// 上报事件
export enum ReportEvent {
  OutOfCameraOver3Minutes = 1, // 人脸不在摄像头3分钟
  NetworkLag = 4, // 网络卡顿
  AppBackground = 6, // app切后台
  AppActive = 7 // app切前台
}

export enum ReplayType {
  Restart = 1,
  Continue
}

// 获取本地视频播放地址类型
export enum GetLocalVideoUrlType {
  Origin,
  Content,
  Teacher
}

export enum PPTType {
  Unknown,
  Video,
  Problem
}

export enum VideoType {
  Unknown,
  Main,
  Analysis,
  RollCall,
  SubmitRight,
  SubmitWrong
}

export enum PPTStatus {
  Unknown,
  Prepare,
  Play,
  Pause,
  Destroy
}

export enum ShowToastType {
  Unknown,
  Brightness,
  Volume,
  PlayProgress
}

export enum PROBLEM_TYPE {
  Single = 1,
  Multi,
  Fill,
  Listen,
  WordBlankFill,
  Cloze,
  Reading,
  ListenComprehension
}

export enum SUBJECT_TYPE {
  Math = 202,
  English = 203
}

export const CLASS_ROOM_STORAGE_KEY_SIGN_IN = 'signIn';
export const CLASS_ROOM_STORAGE_KEY_COIN_PROGRESS = 'coinProgress';

export enum AUDIO_SCENE_ID {
  Unknown,
  FirstRight,
  DoubleRight,
  Comfort,
  Shake,
  RollCall,
  SubmitRight,
  SubmitWrong
}

export enum AnswerState {
  Unknown,
  Right,
  Wrong
}
